function [yhat, x] = im2lr(y, scale, method1, method2)

if nargin < 3, method1 = 'bicubic'; end
if nargin < 4, method2 = method1; end

%%
% clc
if scale < 1
    error('The input scale %d should be larger than 1!', scale);
end

x = imresize(y, 1/scale, method1);
if isempty(method2) || strcmp(method2, 'I')
    yhat = x;
else
    imsize = size(y);
    yhat = imresize(x, imsize(1 : 2), method2);
end
% figure; imshow(ycbcr2rgb(yhat))
